From: Jonas Dreßler Date: Tue, 9 Feb 2021 16:09:05 +0000 (+0100) Subject: screenshot: Remove shooter from sender in finally block X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~616^2^2~384 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=3510b88bdcdada5b4da6efbd6c8ccea2adcbb514;p=gnome-shell.git screenshot: Remove shooter from sender in finally block We do this in both the try{} and the catch{} block, so we might as well put it into a finally{} block. Part-of: --- diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js index 59a6c46af..583f8b7c5 100644 --- a/js/ui/screenshot.js +++ b/js/ui/screenshot.js @@ -200,10 +200,10 @@ var ScreenshotService = class { screenshot.screenshot_area(x, y, width, height, stream), ]); this._onScreenshotComplete(stream, file, invocation); - this._removeShooterForSender(invocation.get_sender()); } catch (e) { - this._removeShooterForSender(invocation.get_sender()); invocation.return_value(new GLib.Variant('(bs)', [false, ''])); + } finally { + this._removeShooterForSender(invocation.get_sender()); } } @@ -223,10 +223,10 @@ var ScreenshotService = class { screenshot.screenshot_window(includeFrame, includeCursor, stream), ]); this._onScreenshotComplete(stream, file, invocation); - this._removeShooterForSender(invocation.get_sender()); } catch (e) { - this._removeShooterForSender(invocation.get_sender()); invocation.return_value(new GLib.Variant('(bs)', [false, ''])); + } finally { + this._removeShooterForSender(invocation.get_sender()); } } @@ -246,10 +246,10 @@ var ScreenshotService = class { screenshot.screenshot(includeCursor, stream), ]); this._onScreenshotComplete(stream, file, invocation); - this._removeShooterForSender(invocation.get_sender()); } catch (e) { - this._removeShooterForSender(invocation.get_sender()); invocation.return_value(new GLib.Variant('(bs)', [false, ''])); + } finally { + this._removeShooterForSender(invocation.get_sender()); } }